package de.koller.worlders.render.visual;

import de.koller.worlders.render.util.TextureRep;
import org.lwjgl.opengl.GL11;

public class ScrollerDRO extends DisplayRenderObject {

	private float scrollSpeed = 10f / 1000f;
	private float currentU = 0;
	
	public ScrollerDRO( TextureRep texture ) {
		super( texture );
	}

	@Override
	protected void init() {
		super.init();
		
		wroot.vmap.addForStep( this );
	}
	
	@Override
	public void step( int elapsedTime ) {
		super.step( elapsedTime );
		
		currentU += scrollSpeed;
	}
	
	@Override
	public void renderObject( float x, float y, float w, float h, float z, boolean fast ) {
		this.renderObject( x, y, w, h, z, fast, currentU, 0, currentU, 1, currentU+1, 1, currentU+1, 0 );
	}

	@Override
	public void preRendering() {
		GL11.glTexParameteri( GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT );
		GL11.glTexParameteri( GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP );
		
		preDROSet();
	}
	
}
